<template>
	<view class="wish-items-list-app">
		<!--
		<my-tabs :items="tab.items" :value="tab.current" :fixed="true" @onTabChange="onTabChange"></my-tabs>
		-->
		<view class="items">
			<view class="empty" v-if="listData.items.length==0" style="text-align: center;">找不到相关数据</view>
			<view class="item" v-for="(item,key) in listData.items" :key="key">
				<view class="fields">
					
					<view class="field">
						<view class="title">被邀请用户姓名:</view>
						<view class="value">{{item.toUserName}}</view>
					</view>
					
					<view class="field">
						<view class="title">被邀请用户手机号:</view>
						<view class="value">{{item.toUserPhone}}</view>
					</view>
					
					<view class="field">
						<view class="title">消费时间:</view>
						<view class="value">{{item.invateTime}}</view>
					</view>
					
				</view>
			</view>
		</view>
		<!--
		<uni-load-more :status="listData.status"></uni-load-more>
		-->
	</view>
</template>

<script>
	import util from '@/libs/util.js'
	import MyTabs from '@/components/my-tabs.vue'
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue'
	
	export default {
		data() {
			return {
				tab: {
					current: null,
					items: [
						{value:null,label:'茶室消费'}
					]
				},
				listData: {
					status: "loading",
					loading: false,
					perpage: 10,
					count: 0,
					page: 1,
					sortby: '',
					sortmethod: '',
					selectIds: [],
					itemIdField: 'id',
					items: [
					]
				}
			};
		},
		onLoad(e) {	

		},
		onShow() {
			this.listData.page = 1
			this.getListData()
		},
		onReachBottom() {
			this.listData.page++
			//this.getListData()
		},
		components: {
			MyTabs,
			uniLoadMore
		},
		methods: {
			...util,
			onTabChange(value) {
				this.tab.current = value
				this.listData.page = 1
				this.getListData()
			},
			getListData() {
			
				if (this.listData.page == 1) {
					this.listData.items = []
					this.listData.count = 0
				}
				
				this.listData.status = "loading"
				this.listData.loading = true
				
				let userId = uni.getStorageSync('userInfo_userId');
				
				this.$api.post('/invite/queryPage', {
					rowCount: 100,
					fromUserId: userId
				}).then((response) => {

					if (response.ret === 1) {
						this.listData.items = response.data;
					} else {
						this.$Message.info(response.msg)
					}
					
					this.listData.loading = false
					//uni.hideLoading()
				})
				
			},
			goPage(url) {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: $uni-bg-color-grey;
	}
	.wish-items-list-app{
		font-size:28upx;
		.items{
			
			.item{
				background-color: white;
			}
			.fields{
				padding: 10upx;
				.field{
					padding: 10upx;
					display: flex;
					.title{
						width:150upx;
					}
					.value{
						
					}
				}
			}
			
			.item{
				/*margin-right:30upx;*/
				margin-bottom:30upx;
				margin-top:30upx;
				border-bottom: 1upx solid #eee;
				padding-bottom: 20upx;
				.info{
					margin-left:20upx;
					display: flex;
					.title{
						font-weight: bold;
						flex:1;
					}
					.intro{
						color:#929292;
					}
					.up{
						color:green;
					}
					.down{
						color:red;
					}
				}
				.date{
					color:#929292;
					text-align: right;
				}
			}
		}
	}

</style>